package com.tanhua.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.model.domain.Analysis;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


public interface AnalysisMapper extends BaseMapper<Analysis> {

    //累计用户(所有注册人数的总和)
    @Select("SELECT sum(num_registered)FROM tb_analysis")
    Integer querySumRegister();

    //根据今日日期,过去日期,获取过去天数活跃用户数量
    @Select("SELECT sum(num_active)FROM tb_analysis WHERE record_date BETWEEN #{pastDate} and #{todaystr} ")
    Integer queryactiveUserCount(@Param("pastDate")String pastDate, @Param("todaystr")String todaystr);

    //当日新增用户数量(当天注册的人数)
    @Select("SELECT num_registered from tb_analysis WHERE record_date = #{todaystr}")
    Integer queryNewUserCount( String todaystr);

    //当日登录次数
    @Select("SELECT num_login from tb_analysis WHERE record_date = #{todaystr}")
    Integer queryLoginCount(String todaystr);

    //当日活跃用户数量
    @Select("SELECT num_active from tb_analysis WHERE record_date = #{todaystr}")
    Integer queryActiveUser(String todaystr);
}
